/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package times.persistence.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "price_slaughter")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PriceSlaughter.findAll", query = "SELECT p FROM PriceSlaughter p"),
    @NamedQuery(name = "PriceSlaughter.findById", query = "SELECT p FROM PriceSlaughter p WHERE p.id = :id"),
    @NamedQuery(name = "PriceSlaughter.findByNumSlaughtered", query = "SELECT p FROM PriceSlaughter p WHERE p.numSlaughtered = :numSlaughtered"),
    @NamedQuery(name = "PriceSlaughter.findByWeight", query = "SELECT p FROM PriceSlaughter p WHERE p.weight = :weight"),
    @NamedQuery(name = "PriceSlaughter.findByPrice", query = "SELECT p FROM PriceSlaughter p WHERE p.price = :price"),
    @NamedQuery(name = "PriceSlaughter.findByComments", query = "SELECT p FROM PriceSlaughter p WHERE p.comments = :comments"),
    @NamedQuery(name = "PriceSlaughter.findByCorrectedPrice", query = "SELECT p FROM PriceSlaughter p WHERE p.correctedPrice = :correctedPrice")})
public class PriceSlaughter implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "num_slaughtered")
    private int numSlaughtered;
    @Basic(optional = false)
    @Column(name = "weight")
    private double weight;
    @Basic(optional = false)
    @Column(name = "price")
    private double price;
    @Basic(optional = false)
    @Column(name = "comments")
    private String comments;
    @Basic(optional = false)
    @Column(name = "corrected_price")
    private double correctedPrice;
    @JoinColumn(name = "price_source_slaughter_header_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private PriceSourceSlaughterHeader priceSourceSlaughterHeaderId;
    @JoinColumn(name = "category_class_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private CategoryClass categoryClassId;

    public PriceSlaughter() {
    }

    public PriceSlaughter(Integer id) {
        this.id = id;
    }

    public PriceSlaughter(Integer id, int numSlaughtered, double weight, double price, String comments, double correctedPrice) {
        this.id = id;
        this.numSlaughtered = numSlaughtered;
        this.weight = weight;
        this.price = price;
        this.comments = comments;
        this.correctedPrice = correctedPrice;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getNumSlaughtered() {
        return numSlaughtered;
    }

    public void setNumSlaughtered(int numSlaughtered) {
        this.numSlaughtered = numSlaughtered;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public double getCorrectedPrice() {
        return correctedPrice;
    }

    public void setCorrectedPrice(double correctedPrice) {
        this.correctedPrice = correctedPrice;
    }

    public PriceSourceSlaughterHeader getPriceSourceSlaughterHeaderId() {
        return priceSourceSlaughterHeaderId;
    }

    public void setPriceSourceSlaughterHeaderId(PriceSourceSlaughterHeader priceSourceSlaughterHeaderId) {
        this.priceSourceSlaughterHeaderId = priceSourceSlaughterHeaderId;
    }

    public CategoryClass getCategoryClassId() {
        return categoryClassId;
    }

    public void setCategoryClassId(CategoryClass categoryClassId) {
        this.categoryClassId = categoryClassId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PriceSlaughter)) {
            return false;
        }
        PriceSlaughter other = (PriceSlaughter) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "times.persistence.entities.PriceSlaughter[ id=" + id + " ]";
    }
    
}
